package com.example.pc.adaptivelandscapeandfagmentationvalues;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


/**
 * A simple {@link Fragment} subclass.
 */
public class RightFragment extends Fragment {


    private TextView tv_title;
    private TextView tv_content;

    public RightFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_right, container, false);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        tv_title = getView().findViewById(R.id.tv_title);
        tv_content = getView().findViewById(R.id.tv_content);
        //
        Bundle arguments = getArguments();
        if (arguments != null) {
            String title = arguments.getString("title");
            String content = arguments.getString("content");
            tv_title.setText(title);
            tv_content.setText(content);
        }
    }

    public void seAtrticle(String title, String content) {
        tv_title.setText(title);
        tv_content.setText(content);
    }
}
